import { Column, Entity,PrimaryGeneratedColumn,Index } from "typeorm";
import { PartnerGroupStatus } from "../interfaces/IPartner.interface";

@Entity()
export class partnerGroupBuy{
    @PrimaryGeneratedColumn({type:'int',name:'id',comment:"自增id"})
    id:number;

    @Column('varchar',{length:12,comment:"开团人"})
    openUserid:number;

    @Index('partnerGroup_userid')
    @Column('varchar',{length:514,comment:"参与拼团的用户信息,最大参团人数40人-122,1244,2344"})
    userids:string;
    
    @Column({type:'int',comment:'项目id'})
    partnerid:number;

    @Column({type:'int',comment:'成团人数-拼团成功的人数要求'})
    clustersNum:number;

    @Column({type:'int',comment:"当前参与的人数"})
    currentNum:number;

    @Index('partnerGroup_status')
    @Column({type:'int',comment:"当前拼团的状态",default:PartnerGroupStatus.Ongoing})
    status:number;

    @Column({type:'int',comment:"拼团开启的时间"})
    addtime:number;

    @Column({type:'int',comment:"拼团的结束时间-如果到这个时间了,还未拼团成功则视为拼团失败"})
    endtime:number;
}